package com.selfdriving.adapter;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.selfdriving.BaseApplication;
import com.selfdriving.BaseObjectListAdapter;
import com.selfdriving.R;
import com.selfdriving.adapter.TravelTogetherAdapter.ViewHolder;
import com.selfdriving.bean.Entity;
import com.selfdriving.bean.TogetherPlay;

public class PeoplesCommentAdapter extends BaseObjectListAdapter
{

	public PeoplesCommentAdapter(BaseApplication application, Context context,
			List<? extends Entity> datas)
	{
		super(application, context, datas);
		// TODO Auto-generated constructor stub
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent)
	{
		// TODO Auto-generated method stub
		ViewHolder holder = null;
		if (convertView == null)
		{
			convertView = mInflater.inflate(R.layout.item_together_view, null);
			holder = new ViewHolder();
			holder.img = (ImageView) convertView
					.findViewById(R.id.user_item_iv_avatar);
			holder.name = (TextView) convertView.findViewById(R.id.uname);
			holder.destination = (TextView) convertView
					.findViewById(R.id.destination);
			holder.goType = (TextView) convertView.findViewById(R.id.content);
			holder.mLayoutGender = (LinearLayout) convertView
					.findViewById(R.id.user_item_layout_gender);
			holder.mIvGender = (ImageView) convertView
					.findViewById(R.id.user_item_iv_gender);
			convertView.setTag(holder);
		} else
		{
			holder = (ViewHolder) convertView.getTag();
		}
		TogetherPlay play = (TogetherPlay) mDatas.get(position);
		mApplication.imageLoader.displayImage(play.getHeadImg(), holder.img,
				mApplication.options);
		return convertView;
	}

	class ViewHolder
	{
		ImageView mIvGender;
		LinearLayout mLayoutGender;
		ImageView img;
		TextView name;
		TextView destination;
		TextView goType;
	}

}
